<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>客房展示</title>
    <%--BootStrap美化页面--%>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">

</head>
<body>

<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 colum">
            <div class="page-header">
                <h1>
                    <small>客房列表 ------- 显示所有客房</small>
                </h1>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-4 column">

            <%--toAddUser--%>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/room/toAddRoom">新增客房</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/room/all">显示全部客房</a>
        </div>
        <div class="col-md-4 column"></div>
        <div class="col-md-4 column">
            <%--查询用户--%>
            <form class="form-inline" action="${pageContext.request.contextPath}/room/selectRoom" method="post" style="float: right">
                <input type="text" name="selectRoomName" class="form-control" placeholder="请输入要查询的房间名">
                <span style="color: red;font-weight: bold">${error}</span>
                <input type="submit" class="btn btn-primary" value="查询">
            </form>
        </div>
    </div>
</div>


<div class="row clearfix">
    <div class="col-md-12 column">
        <table class="table table-hover table-striped">
            <thead>
            <tr>
                <th>客房ID</th>
                <th>客房名称</th>
                <th>客房描述</th>
                <th>客房状态</th>
                <th>操作</th>
            </tr>
            </thead>

            <%--用户从数据库中查询出来，从list中遍历出来：foreach--%>
            <tbody>
                <c:forEach var="room" items="${allRoom}">
                    <tr>
                        <td>${room.roomId}</td>
                        <td>${room.roomName}</td>
                        <td>${room.roomDesc}</td>
                        <td>${room.status}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/room/toUpdateRoom?id=${room.roomId}">修改</a>
                            &nbsp; | &nbsp;
                            <a href="${pageContext.request.contextPath}/room/deleteRoom/${room.roomId}">删除</a>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>
</div>


</body>
</html>
